package com.sc.userspringboot.controller;

import com.sc.userspringboot.pojo.PostImages;
import com.sc.userspringboot.service.IPostImagesService;
import com.sc.userspringboot.utils.ResponseMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 帖子图片关联表 前端控制器
 * </p>
 *
 * @author user
 * @since 2025-09-19 06:25:46
 */
@RestController
@RequestMapping("/postImages")
public class PostImagesController {

    @Autowired
    IPostImagesService postImagesService;

    @RequestMapping("add")
    ResponseMsg add(@RequestBody PostImages postImages) {
        if(postImages.getPostId() == null){
            return ResponseMsg.getInstance(ResponseMsg.ERROR,"postId不能为空");
        }

        return ResponseMsg.getInstance(ResponseMsg.SUCCESS,"添加成功",postImagesService.save(postImages));
    }
}
